package org.trebert.web;

import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;

public class HalloServlet extends HttpServlet {
	private static final long serialVersionUID = 4190306944894029861L;

	@Override
	public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		String name = request.getParameter("name");
		name = name != null ? name : "Du";
		PrintWriter out = response.getWriter(); // Ich will in den Ausgabestream schreiben
		
		out.print("<html>\n<head><title>Das Hallo Servlet</title></head>\n");
		out.print("<body>\n");
		out.print("<h3>Hallo " +name+ "!<h3>\n<br />");
		out.print("</body>\n");
		out.print("</html>\n");
	}
	
	@Override
	public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
		doGet(request, response);
	}
	
}
